<!doctype html>
<html>
<head>
<meta charset="utf-8">
{include_core file="lib/seoinfo.html" title="第三方帐号绑定" keywords="" description=""}
{load_js file="jquery-1.7.1.min.js"}
{load_js file="common.js"}
{load_js file="style.js"}
{load_css file="css/base.css"}
{load_css file="css/common.css"}
{load_css file="css/style.css"}
</head>
<body>
<div id="wrap" class="wrap1">
  <div id="header">
    <div class="login-head-inner clearfix">
      <h1 class="logo"><a href="{AnUrl('')}"><img src="{$smarty.const.SITE_URL}/images/logo.png" width="112" height="36"></a></h1>
      <a href="javascript:void(0);" class="link">第三方绑定帐号</a>
    </div>
  </div>
  <div id="container">
  	<div class="login-box associate3">
      <div class="login-inner">
        <div class="associate-head">
          <h2>关联NBD账号</h2>
        </div>
        <div class="input-box">
    	<form action = "{AnUrl('openapi/check_bind')}" id="btn_c_form" method="post">
          <div class="txt-box">
            <p class="txt-wrap1 clearfix">
            	<input type="text" placeholder="邮箱/手机号/NBD账号" name="username" id="username" class="txt1"/>
            	<span class="prompt hidden" id="user_hint">
        			<i class="false-icon"></i>
    			</span>
    		</p>
            <p class="txt-wrap1 clearfix">
        		<input type="password" placeholder="密码" name="password" id="password" class="txt1"/>
    			<span class="prompt hidden" id="pass_hint">
    				<i class="false-icon"></i>
    			</span>
    		</p>
          </div>
        </form>
          <p><a href="javascript:void(0);" id="btn_login" class="btn2 login-btn clearfix">立即绑定</a></p>
          <p><a href="{AnUrl('openapi/bind_new')}" class="btn1 register-btn clearfix">创建新账号</a></p>
        </div>
      </div>
    </div>
    {include_core file="lib/bottom_copy.html"}
  </div>
  </div>
  <script>
$(function(){
	$('#user_hint, #pass_hint').click(function(){
		$(this).hide();
	});
  $('#btn_login').click(function(){
    $('#btn_login').html('正在绑定...');
    var username = $.trim($('#username').val());
    var password = $.trim($('#password').val());
    var iconHtml = '<i class="false-icon"></i>';
    if(username == '') {
      $('#user_hint').show().html(iconHtml + '用户名不能为空');
      $('#btn_login').html('立即绑定');
      return;
    } 
    if(password == '') {
      $('#pass_hint').show().html(iconHtml + '密码不能为空');
      $('#btn_login').html('立即绑定');
      return;
    }
    
    $.post(
        "{AnUrl('openapi/check_bind')}",
        { "username" : username, "password":password },
        function(data){
          if(data.info == 'error') {
            if(data.type == 'user') {
              $('#user_hint').show().html(iconHtml + data.msg);
              $('#btn_login').html('立即登录');
              return;
            } else {
              $('#pass_hint').show().html(iconHtml + data.msg);
              $('#btn_login').html('立即登录');
              return;
            }
          } else {
            $('#btn_c_form').submit();
          }
        },'json');
    
  });
})
  </script>
  </body>
</html>